#! /usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = "Mosson"
from rest_framework import serializers
from .models import Banner, Nav

"""
一个完整的modelserializer要有什么
1 字段说明
2 模型序列化器字段说明
3 验证方法
4 存储数据的方法
"""

class BannerModelSerializer(serializers.ModelSerializer):
    """轮播广告的序列化器"""
    class Meta:
        model = Banner
        fields = ["image_url", "link"]


class NavModelSerializer(serializers.ModelSerializer):
    """ 头部导航的序列化器 """
    class Meta:
        model = Nav
        fields = ["title", "link", "position", "is_site"]


